<template>
  <el-image :src="src" :style="{'width':width,'height':height}" :preview-src-list="ifPreview?preList:[]"></el-image>
</template>
<script>
export default {
    props: {
        src: {
            default: '',
            type: String,
            required:true
        },
        width: {
            default: '100px',
            type: String,
        },
        height: {
            default: '100px',
            type: String,
        },
        ifPreview: {
            default: false,
            type: Boolean
        }
    },
    watch: {
        ifPreview: {
            handler(val) {
                if (val) {
                    this.preList[0]=this.src  
                }
            },
            deep: true,
            immediate:true
        }
    },
    created() {
    },
    data () {
        return {
            preList:[]
        }
    }
}
</script>

<style lang="scss" scoped>

</style>